<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>AngloSaxonRuneFormatTest</title>

<link rel="stylesheet"
	href="http://code.jquery.com/qunit/qunit-1.15.0.css">
<script src="http://code.jquery.com/qunit/qunit-1.15.0.js"></script>

<script src="../../main/js/util/Logger.js"></script>

<script src="../../main/js/AngloSaxonRune.js"></script>
<script src="../../main/js/AngloSaxonRuneFormat.js"></script>

<script>
    var LOGGER = new Logger();

    QUnit.test("format()", function(assert)
    {
        // Setup.
        var runes = [ AngloSaxonRune.FEOH, AngloSaxonRune.UR,
                AngloSaxonRune.THORN ];

        // Run.
        var result = AngloSaxonRuneFormat.format(runes);

        // Verify.
        assert.equal(result, "FEOH-UR-THORN");
    });

    QUnit.test("parse()", function(assert)
    {
        // Setup.
        var string = "FEOH-UR-THORN";

        // Run.
        var result = AngloSaxonRuneFormat.parse(string);

        // Verify.
        var expected = [ AngloSaxonRune.FEOH, AngloSaxonRune.UR,
                AngloSaxonRune.THORN ];
        assert.equal(result.length, 3);

        for (var i = 0; i < result.length; i++)
        {
            assert.equal(result[i], expected[i], "" + i);
        }
    });

    QUnit.test("getFontLetters()", function(assert)
    {
        // Setup.
        var runes = [ AngloSaxonRune.FEOH, AngloSaxonRune.UR,
                AngloSaxonRune.THORN ];

        // Run.
        var result = AngloSaxonRuneFormat.getFontLetters(runes);

        // Verify.
        assert.equal(result, "\u16a0\u16a2\u16a6");
    });
</script>
</head>
<body>
	<div id="qunit"></div>
</body>
</html>
